import { defineStore } from 'pinia'
import { defineAsyncComponent, markRaw, ref, type Component } from 'vue'
import { Desktop } from '@vicons/ionicons5'
export const usePageConfig = defineStore('pageConfig', () => {
  const pageConfig = ref([
    {
      label: '首页',
      icon: markRaw(Desktop),
      component: defineAsyncComponent(() => import('@/views/dashboard/index.vue')),
      type: 'item',
    },    {
      label: '更新日志管理',
      icon: markRaw(Desktop),
      component: defineAsyncComponent(() => import('@/views/updateLog/index.vue')),
      type: 'item',
    },    {
      label: '会话管理',
      icon: markRaw(Desktop),
      component: defineAsyncComponent(() => import('@/views/chatHistory/index.vue')),
      type: 'item',
    },
  ])
  const activePage = ref(pageConfig.value[0].label)
  const pageList = ref<Record<string, { label: string, component: Component, type: string }>>({})
  pageList.value[pageConfig.value[0].label] = pageConfig.value[0]
  return {
    pageConfig,
    activePage,
    pageList,
  }
})
